ssl: Buffer unsent encrypted data on send timeout - #10916
Open
zuiderkwast wants to merge 2 commits into
Open
Conversation
Contributor
CT Test Results 2 files 66 suites 25m 41s ⏱️ For more details on these failures, see this check. Results for commit b5242b5. ♻️ This comment has been updated with latest results. To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass. See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally. Artifacts
// Erlang/OTP Github Action Bot |
Contributor
|
We will consider this after the OTP-29 release. |
When using gen_tcp with {inet_backend, socket} and send_timeout,
gen_tcp:send may return {error, {timeout, RestData}} with the unsent
encrypted data. Previously this fell through to the generic error
handler which killed the connection.
Buffer the RestData in a new #rest{} record in the tls_sender state
and retry sending it together with new data on the next ssl:send call.
Reply {error, timeout} to the caller to simulate {inet_backend, inet}
behavior.
When alerts, post-handshake data or renegotiation need to send while
a #rest{} buffer exists, attempt to flush the buffer first. If the
flush succeeds, proceed normally. If it times out again, postpone the
event and re-buffer the remaining data.
Signed-off-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
zuiderkwast
force-pushed
the
ssl-socket-backend-timeout-buffering
branch
from
July 2, 2026 13:21
6009ad8 to
5763bb5
Compare
Signed-off-by: Viktor Söderqvist <viktor.soderqvist@est.tech>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When using
gen_tcpwith{inet_backend, socket}andsend_timeout,gen_tcp:sendmay return{error, {timeout, RestData}}with the unsent encrypted data. Previously this fell through to the generic error handler which killed the connection.Buffer the
RestDatain a new#rest{}record in thetls_senderstate and retry sending it together with new data on the nextssl:sendcall. Reply{error, timeout}to the caller to simulate{inet_backend, inet}behavior.When alerts, post-handshake data or renegotiation need to send while a
#rest{}buffer exists, attempt to flush the buffer first. If the flush succeeds, proceed normally. If it times out again, postpone the event and re-buffer the remaining data.